package com.atguigu.spzx.cloud.user.controller;

import com.atguigu.spzx.cloud.user.entity.User;
import com.atguigu.spzx.cloud.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.time.ZonedDateTime;

@RestController
@RequestMapping(value = "/api/user")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService ;

    @GetMapping(value = "/findUserByUserId/{userId}")
    public User findUserByUserId(@PathVariable(value = "userId") Long userId ,@RequestHeader(name = "Truth")String header) {
//获取当前时区时间代码
        ZonedDateTime zonedDateTime = ZonedDateTime.now();
        System.out.println(zonedDateTime);
        log.info("UserController...findUserByUserId方法执行了... ,header: {} " , header);
        return userService.findUserByUserId(userId) ;
    }

}